from django.contrib.auth.models import Permission, Group
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from django.contrib.auth.models import ContentType
from meiduo_admin.serializers.permission import PermissionSerializer, ContentTypeSerializer, GroupSerializer
from meiduo_admin.utils import PageNum
# from meiduo_admin.serializers.permission import ContentTypeSerializer
# ContentTypeSerializer()
class PermissionView(ModelViewSet):
    serializer_class = PermissionSerializer
    queryset = Permission.objects.all().order_by('id')
    pagination_class = PageNum

class ListPermissionView(ModelViewSet):
    serializer_class = ContentTypeSerializer
    queryset = ContentType.objects.all()


class PermissionGroupView(ListAPIView):
    serializer_class = GroupSerializer
    queryset = Group.objects.all()
    pagination_class = PageNum


